#pragma once
#include <string>
#include <memory>
#include <iostream>

#include "Logger.h"

#ifdef __linux__ 
#define DECLARE_DLL(classname) extern "C" \
{ \
	classname *pluginCreator() \
	{ \
		return new classname(); \
	} \
	void pluginDeleter(classname *ptr) \
	{ \
		delete ptr; \
	} \
} 
#endif

#ifdef WIN32
#define DECLARE_DLL(classname) extern "C" \
{ \
	__declspec (dllexport) classname *pluginCreator() \
	{ \
		return new classname(); \
	} \
	__declspec (dllexport) void pluginDeleter(classname *ptr) \
	{ \
		delete ptr; \
	} \
} 
#endif

class CFormatMassage;
class BasicPlugin
{
public:
	BasicPlugin(const std::string& str)
		: m_pluginName(str)
	{}
	virtual ~BasicPlugin()
	{
		//LOGERROR("BasicPlugin destructor");
	}
	
	void setPluginName(const std::string& name) { m_pluginName = name; }
	std::string& getPluginName() { return m_pluginName; }

	virtual void process(std::shared_ptr<CFormatMassage>& ) = 0;


protected:
	std::string m_pluginName;
};